-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Integrate d2-logger (coding dojo ----DO NOT MERGE----- ) #23
base: development
Are you sure you want to change the base?
Conversation
…into feat/d2-logger
…into feat/d2-logger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Just some details and we're done
const mapping: Record<OutbreakDataType, TrackedEntityAttributeId> = { | ||
disease: RTSL_ZEBRA_ALERTS_DISEASE_TEA_ID, | ||
hazard: RTSL_ZEBRA_ALERTS_EVENT_TYPE_TEA_ID, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the mapping is static, it can be defined at the root level and the function.
}[]; | ||
} & { | ||
[key in OutbreakDataType]?: string; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed this a little bit on the Dojo, what was the conclusion? I I think this should work:
{
//...
type: OutbreakDataType;
description: string // "description" or other name
//...
}
This works if the type only has one of the types, but that's the case, right?
const mapping: Record<OutbreakDataType, DataSource> = { | ||
disease: DataSource.RTSL_ZEB_OS_DATA_SOURCE_IBS, | ||
hazard: DataSource.RTSL_ZEB_OS_DATA_SOURCE_EBS, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same.
src/scripts/common.ts
Outdated
throw new Error("VITE_DHIS2_AUTH must be set in the .env file"); | ||
|
||
const username = process.env.VITE_DHIS2_AUTH.split(":")[0] ?? ""; | ||
const password = process.env.VITE_DHIS2_AUTH.split(":")[1] ?? ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposal:
const [username, password] = process.env.VITE_DHIS2_AUTH.split(":")
if (!username || !password)
move to root of file or to data repository util
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good code-wise!
import { | ||
RTSL_ZEBRA_ALERTS_DISEASE_TEA_ID, | ||
RTSL_ZEBRA_ALERTS_EVENT_TYPE_TEA_ID, | ||
} from "../consts/DiseaseOutbreakConstants"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to change, but to avoid long imports and dispersion of info, values can be grouped in the constants file by some criteria.
📌 References
📝 Implementation
📹 Screenshots/Screen capture
🔥 Notes to the tester
To test:
yarn script-map-outbreak-to-alerts
Logs are saved as events in the RTSL_ZEBRA_MAPPING_LOGGER event program [usU7YBzuhaE].
#8695pt0av